// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import { NotificationCenter } from "./NotificationCenter";

class CallAndroid
{
    private static _instance:CallAndroid = null;
    public static getInatance(){
        if(this._instance==null) this._instance = new CallAndroid();
        return this._instance;
    }
    public videoRewardComplete(){
        console.log("视频广告返回了:：：哈哈哈哈哈哈哈哈哈，高兴得跳起来了");
        NotificationCenter.Instance.emit("requestFinishAd");
    }
    public videoRewardClose(){
        console.log("视频广告返回了:：：哈哈哈哈哈哈哈哈哈，高兴得跳起来了");
        NotificationCenter.Instance.emit("serviceClosedAd");
    }
    public rewardState(state: string){
        console.log("视频广告状态:：：哈哈哈哈哈哈哈哈哈，高兴得跳起来了：：："+state);
        NotificationCenter.Instance.emit("rewardAdState", state);
    }
    public wxLoginResp(code){
        console.log("微信返回了:：：哈哈哈哈哈哈哈哈哈，高兴得跳起来了"+code);
        NotificationCenter.Instance.emit("requestBindWx", code);
    }
}
//第一种方法
window["CallAndroid"] = CallAndroid.getInatance();
//第二种方法
// window.callAndroid = CallAndroid.getInatance();
// declare interface Window{
//     callAndroid:CallAndroid;
// }
